package cn.hdustea.shopNavigation.ui.presenter

import cn.hdustea.shopNavigation.entity.Food
import cn.hdustea.shopNavigation.ui.contract.FoodContract
import cn.hdustea.shopNavigation.ui.model.FoodModel
import com.hdustea.base.base.BasePresenter

/**
 * <pre>
 *     author : HuQiang
 *     time   : 2020/09/21
 *     desc   :
 *     version: 1.0
 * </pre>
 */
class FoodPresenter(mView: FoodContract.View) : BasePresenter<FoodContract.View, FoodContract.Model>(mView), FoodContract.Presenter {

    override fun getModel(): FoodContract.Model = FoodModel()

    override fun getFoodList(page: Int, isRefresh: Boolean) {
        mModel.getFoodList(page, object : PresenterCallback<MutableList<Food>>() {
            override fun callback(data: MutableList<Food>) {
                mView?.dismissLoading()
                mView?.setFoodList(data, isRefresh)
            }
        })
    }


} 